﻿using System;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using LiveCharts;
using LiveCharts.Charts;
using LiveCharts.Definitions.Points;
using LiveCharts.Dtos;
using LiveCharts.Wpf;
using LiveCharts.Wpf.Points;

internal class Class9 : PointView, IChartPointView, IRectanglePointView
{
    [CompilerGenerated]
    public Class3 method_0()
    {
        return this.class3_0;
    }

    [CompilerGenerated]
    public void method_1(Class3 class3_1)
    {
        this.class3_0 = class3_1;
    }

 
    public CoreRectangle Data { get; set; }

 
    public double ZeroReference { get; set; }

    [CompilerGenerated]
    public BarLabelPosition method_2()
    {
        return this.barLabelPosition_0;
    }

    [CompilerGenerated]
    public void method_3(BarLabelPosition barLabelPosition_1)
    {
        this.barLabelPosition_0 = barLabelPosition_1;
    }

    public override void DrawOrMove(ChartPoint previousDrawn, ChartPoint current, int index, ChartCore chart)
    {
        Class9.Class10 @class = new Class9.Class10();
        @class.class9_0 = this;
        @class.chartCore_0 = chart;
        base.ValidArea = new CoreRectangle(this.Data.Left, this.Data.Top, this.Data.Width, this.Data.Height);
        if (base.IsNew)
        {
            this.method_0().width = (0.0);
            this.method_0().height = (this.Data.Height);
            this.method_0().point = (new Point(this.ZeroReference, this.Data.Top));
            this.method_0().method_7(false, TimeSpan.Zero);
            this.pathGeometry_0 = (PathGeometry)((GRowSeries)current.SeriesView).ShapesStroke.Path_0.Data;
            this.pathGeometry_0.Figures.Add(this.method_0().pathFigure_0);
            if (base.DataLabel != null)
            {
                Canvas.SetTop(base.DataLabel, this.Data.Top);
                Canvas.SetLeft(base.DataLabel, this.ZeroReference);
            }
        }
        Func<double> func = new Func<double>(@class.method_0);
        Func<double> func2 = new Func<double>(@class.method_1);
        this.method_0().width = (this.Data.Width);
        this.method_0().height = (this.Data.Height);
        this.method_0().point = (new Point(this.Data.Left, this.Data.Top));
        if (@class.chartCore_0.View.DisableAnimations)
        {
            this.method_0().method_7(false, TimeSpan.Zero);
            if (base.DataLabel != null)
            {
                base.DataLabel.UpdateLayout();
                Canvas.SetTop(base.DataLabel, func());
                Canvas.SetLeft(base.DataLabel, func2());
            }
            if (base.HoverShape != null)
            {
                Canvas.SetTop(base.HoverShape, this.Data.Top);
                Canvas.SetLeft(base.HoverShape, this.Data.Left);
                base.HoverShape.Height = this.Data.Height;
                base.HoverShape.Width = this.Data.Width;
            }
            return;
        }
        TimeSpan animationsSpeed = @class.chartCore_0.View.AnimationsSpeed;
        if (base.DataLabel != null)
        {
            base.DataLabel.UpdateLayout();
            base.DataLabel.BeginAnimation(Canvas.LeftProperty, new DoubleAnimation(func2(), animationsSpeed));
            base.DataLabel.BeginAnimation(Canvas.TopProperty, new DoubleAnimation(func(), animationsSpeed));
        }
        this.method_0().method_7(true, animationsSpeed);
    }

    public override void RemoveFromView(ChartCore chart)
    {
        chart.View.RemoveFromDrawMargin(base.HoverShape);
        chart.View.RemoveFromDrawMargin(this.method_0());
        chart.View.RemoveFromDrawMargin(base.DataLabel);
    }

    public override void OnHover(ChartPoint point)
    {
    }

    public override void OnHoverLeave(ChartPoint point)
    {
    }

    private PathGeometry pathGeometry_0;

    [CompilerGenerated]
    private Class3 class3_0;

    [CompilerGenerated]
    private CoreRectangle coreRectangle_0;

    [CompilerGenerated]
    private double double_0;

    [CompilerGenerated]
    private BarLabelPosition barLabelPosition_0;

    [CompilerGenerated]
    private sealed class Class10
    {
        internal double method_0()
        {
            double num = this.class9_0.Data.Top + this.class9_0.Data.Height / 2.0 - this.class9_0.DataLabel.ActualHeight / 2.0;
            if (num < 0.0)
            {
                num = 2.0;
            }
            if (num + this.class9_0.DataLabel.ActualHeight > this.chartCore_0.DrawMargin.Height)
            {
                num -= num + this.class9_0.DataLabel.ActualHeight - this.chartCore_0.DrawMargin.Height + 2.0;
            }
            return num;
        }

        internal double method_1()
        {
            double num;
            if (this.class9_0.method_2() == BarLabelPosition.Merged)
            {
                num = this.class9_0.Data.Left + this.class9_0.Data.Width / 2.0 - this.class9_0.DataLabel.ActualWidth / 2.0;
            }
            else if (this.class9_0.Data.Left < this.class9_0.ZeroReference)
            {
                num = this.class9_0.Data.Left - this.class9_0.DataLabel.ActualWidth - 5.0;
                if (num < 0.0)
                {
                    num = this.class9_0.Data.Left + 5.0;
                }
            }
            else
            {
                num = this.class9_0.Data.Left + this.class9_0.Data.Width + 5.0;
                if (num + this.class9_0.DataLabel.ActualWidth > this.chartCore_0.DrawMargin.Width)
                {
                    num -= this.class9_0.DataLabel.ActualWidth + 10.0;
                }
            }
            return num;
        }

        public Class9 class9_0;

        public ChartCore chartCore_0;
    }
}
